Obtaining and Releasing IconRefs
In order to call Icon Services functions, your application must
obtain an IconRef
for the icon data you want to use. There are three functions you can use to accomplish this task; the one you choose depends on how much information you have about the icon you wish to use. If you need an icon from the desktop database or a registered icon
(an icon that has been previously identified to Icon Services), the simplest and fastest way to obtain an IconRef
is to use the function GetIconRef. Icon Services defines a number of constants for non-fileFinder icons, which makes it simple to use the GetIconRef
function to obtain an IconRef
for one of these icons.
Listing 1-1
shows an example of how to obtain an IconRef
for the standard Help icon:
Listing 1-1
Obtaining an IconRef for the standard help icon
err = GetIconRef(kOnSystemDisk, kSystemIconsCreator, kHelpIcon,
&iconRef);
If you need an IconRef
for a folder that you know has no custom icons associated with it, use the function GetIconRefFromFolder. If you need an IconRef
for a file object for which you don't have any information, use the function GetIconRefFromFile.
© 1999 Apple Computer, Inc. – (Last Updated 03 Dec 99)